<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../Ajs/vue.js"></script>
    <style>
        div,ul,ol,li{
            margin: 0;
            padding: 0;
        }
        li{
            list-style: none;
        }
        #box1 ul{
            height: 30px;
        }
        #box1 ul li{
            float: left;
            /*display: inline-block;*/
            width: 100px;
            height: 30px;
            line-height: 30px;
            border: 1px solid #000;
            cursor:pointer;
        }
        #box1 ul li + li{
            border-left: 0;
        }
        #box1 ul li.bj1{
            background-color: #eee;
        }

        #box1 ol{
            position: relative;
        }
        #box1 ol li{
            position: absolute;
            top: 0;
            left: 0;
            width: 302px;
            height: 100px;
            background-color: #fff;
            border: 1px solid #000;
            display: none;
        }
        #box1 ol li.bj2{
            display: block;
        }
    </style>
</head>
<body>

<div id="box1">
    <ul>
        <li @click="fn(index)" :class="xs==index?'bj1':''" v-for="(item,index) in dataList" :key="item.id">{{item.title}}</li>
    </ul>
    <ol>
        <li :class="xs==index?'bj2':''" v-for="(item,index) in dataList" :key="item.id">{{item.content}}</li>
    </ol>
</div>

<script>
    new Vue({
        el:"#box1",
        data:{
            xs:0,
            dataList:[
                {
                    id:1,
                    title:"标题1",
                    content:"标题1内容"
                },
                {
                    id:2,
                    title:"标题2",
                    content:"标题2内容"
                },
                {
                    id:3,
                    title:"标题3",
                    content:"标题3内容"
                }

            ]
        },
        methods:{
            fn: function(index){
                this.xs = index;
            }
        }
    })
</script>
</body>
</html>